package com.dw.library.view;

import com.dw.library.R;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;

/**
 * 
 */
public class ImageIndicator extends AbsViewPagerIndicator {
  private static final String TAG = "ImageIndicator";

  public ImageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
  }

  public ImageIndicator(Context context, AttributeSet attrs) {
    super(context, attrs);
  }

  public ImageIndicator(Context context) {
    super(context);
  }

  @Override
  protected void drawBackground(Canvas canvas, float left, float top, float right, float bottom) {
    Drawable drawable = this.getResources().getDrawable(R.drawable.bg);
    Rect rect = new Rect((int)left, (int)top, (int)right, (int)bottom);
    drawable.setBounds(rect);
    drawable.draw(canvas);
  }

  @Override
  protected void drawIndicator(Canvas canvas, float left, float top, float right, float bottom) {
    Drawable drawable = this.getResources().getDrawable(R.drawable.indicator);
    Rect rect = new Rect((int)left, (int)top, (int)right, (int)bottom);
    drawable.setBounds(rect);
    drawable.draw(canvas);
  }
}
